In a multi-thread process, one process is divided into multiple threads and the threads are executed concurrently. In this process, a certain variable is written among the threads. A variable written among the threads is referred to as a common variable.
In a single-core processor system, threads having a common variable are executed through serial processing, thereby preventing a case where the final value of the common variable varies consequent a change in the execution order of the threads.
A banner display process by a browser will be described with regard to a common variable. In the banner display process, data to be displayed is stored in shared memory. When multiple banner display processes are executed, data to be displayed by each banner display process is stored in the memory according to the display order of the banners (Z order) described in a hyper text makeup language (HTML) document. Displayed banners may overlap each other depending on display patterns. To avoid such a case, the banner display process must be executed according to the display order of the banners. Hence, the serial process is performed as described above.
In a shared memory multi-core processor system, a multi-core processor assigns each thread to an arbitrary central processing unit (CPU), where the thread is processed. In the multi-core processor system, each CPU executes threads assigned thereto regardless of the execution status of other CPUs. When executing a thread having a common variable, the CPUs must perform serial processing or synchronization processing of the thread and other threads having the common variable.
The common variable is stored to the cache memory of each CPU. Through communication between CPUs, the common variable is then written to the shared memory, based on the execution status of other threads (see, for example, Japanese Laid-Open Patent Publication Nos. 2003-30049 and H10-116192).
However, serial processing poses a problem of a drop in throughput, and synchronization processing poses a problem of a decline in execution efficiency due to overhead. When the common variable is stored to the cache memory of each CPU in a multi-core processor system, if multiple threads are assigned to the same CPU, execution of the serial processing causes the problem of a drop in throughput. In addition, communication between CPUs creates overhead, leading to the problem of reduced execution efficiency.